package org.sociald.wave.learning;


import com.google.code.facebookapi.FacebookXmlRestClient;
import org.sociald.wave.common.BareBonesBrowserLaunch;

/**
 * Created by IntelliJ IDEA.
 * User: jgleason
 * Date: Dec 9, 2009
 * Time: 8:42:48 PM
 * To change this template use File | Settings | File Templates.
 */
public class FacebookUserFilter {
    private static final String FACEBOOK_API_KEY = "3f0d311e56d6af31a74603e142997063";
    private static final String FACEBOOK_SECRET = "26552151c07e0552c6fca69818c10e13";

    public static String getFaceBook(String test) {
        //try {

        // Create the client instance
        FacebookXmlRestClient client = new FacebookXmlRestClient(FACEBOOK_API_KEY, FACEBOOK_SECRET);

        // is this a desktop app
        //client.setIsDesktop(true);

        // first, we need to get an auth-token to log in with
        //Logon(client.auth_createToken());


        //} catch (FacebookException e) {
        //e.printStackTrace();
        //}
        return "test";
    }

    //public static FacebookXmlRestClient getUserClient(HttpSession session) {
    //      return (FacebookXmlRestClient)session.getAttribute(FACEBOOK_USER_CLIENT);
    //}
    public static void Logon(String token) {
        // Build the authentication URL for the user to fill out
        String url = "http://www.facebook.com/login.php?api_key=" + FACEBOOK_API_KEY + "&v=1.0" + "&auth_token=" + token;
        // open browser for user to log in
        BareBonesBrowserLaunch.openURL(url);
    }
}
